package com.liupei.exception;

import com.liupei.enums.ResultCode;

/**
 *  业务层的异常
 * @ClassNameServiceException
 * @Description
 * @Author liupei
 * @Emaile 3268727800@qq.com
 * @Date2021/3/12 16:38
 * @Version V1.0
 **/
public class ServiceException extends RuntimeException{
    private Integer code;


    public ServiceException() {
        super(ResultCode.ERROR.getMsg());
        this.code = ResultCode.ERROR.getCode();
    }

    public ServiceException(String msg) {
        super(msg);
        this.code =  ResultCode.ERROR.getCode();
    }


    public ServiceException(ResultCode code) {
        super(code.getMsg());
        this.code = code.getCode();
    }
    public ServiceException(int code,String msg) {
        super(msg);
        this.code = code;
    }

    /**
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(int code) {
        this.code = code;
    }


}
